import 'package:flutter/material.dart';
import 'package:tender_flutter/constant/theme_colors.dart';
import 'package:tender_flutter/utils/screen_adaper.dart';

class TenderTagCell extends StatefulWidget {
  const TenderTagCell({Key key, this.title, this.onTap, this.selected})
      : super(key: key);

  final bool selected;
  final String title;
  final GestureTapCallback onTap;

  @override
  _TenderTagCellState createState() => _TenderTagCellState();
}

class _TenderTagCellState extends State<TenderTagCell> {
  @override
  Widget build(BuildContext context) {
    return _initCell();
  }

  Widget _initCell() {
    return GestureDetector(
        onTap: widget.onTap,
        child: Container(
          margin: EdgeInsets.symmetric(vertical: ScreenAdapter.height(10)),
          padding: EdgeInsets.symmetric(
              vertical: ScreenAdapter.height(10),
              horizontal: ScreenAdapter.width(20)),
          decoration: BoxDecoration(
              color: widget.selected
                  ? ThemeColors.colorType6
                  : ThemeColors.colorType57,
              border: Border.all(
                  color: widget.selected
                      ? ThemeColors.colorTransparent
                      : ThemeColors.colorType45,
                  width: 1),
              borderRadius:
                  BorderRadius.all(Radius.circular(ScreenAdapter.width(6)))),
          child: Text(widget.title,
              textAlign: TextAlign.center,
              style: TextStyle(
                  color: widget.selected
                      ? ThemeColors.colorWhite
                      : ThemeColors.colorType7,
                  fontSize: ScreenAdapter.sp(28),
                  fontWeight: FontWeight.w500)),
        ));
  }
}
